package org.example.curriculum_design_6_16.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.curriculum_design_6_16.entity.pojo.PoliticalPerformance;
import org.example.curriculum_design_6_16.service.PoliticalPerformanceService;
import org.example.curriculum_design_6_16.mapper.PoliticalPerformanceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author 郑凯
* @description 针对表【political_performance】的数据库操作Service实现
* @createDate 2025-06-16 09:25:48
*/
@Service
public class PoliticalPerformanceServiceImpl extends ServiceImpl<PoliticalPerformanceMapper, PoliticalPerformance>
    implements PoliticalPerformanceService{

    @Autowired
    private PoliticalPerformanceMapper politicalPerformanceMapper;

    public PoliticalPerformanceServiceImpl(PoliticalPerformanceMapper politicalPerformanceMapper) {
        this.politicalPerformanceMapper = politicalPerformanceMapper;
    }

    @Override
    public PoliticalPerformance selectByStudentId(String studentId) {
        return politicalPerformanceMapper.selectByStudentId(studentId);
    }

    @Override
    public PoliticalPerformance selectByStudentId(String studentId, String academicYear) {
        return politicalPerformanceMapper.selectByStudentIdAndYear(studentId, academicYear);
    }

    @Override
    public PoliticalPerformance getAllPoliticalPerformance() {
        return politicalPerformanceMapper.getAllPoliticalPerformance();
    }

    @Override
    public int deleteByStudentId(String studentId) {
        return politicalPerformanceMapper.deleteByStudentId(studentId);
    }

    @Override
    public int updateScore(String studentId, double newScore) {
        return politicalPerformanceMapper.updateScore(studentId, newScore);
    }

    @Override
    public boolean isBaseScoreZeroInSemester(String studentId) {
        return politicalPerformanceMapper.isBaseScoreZeroInSemester(studentId);
    }
}




